﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace CustomSerializer.Tests
{
    [TestClass]
    public class TestSimpleTypeArrays : TestBase
    {
        [TestInitialize]
        public void Init()
        {
            InitSerializer();
        }

        [TestMethod]
        public void SingleObject()
        {
            var o = new SimpleTypeArrays(true);
            TestObject(ser, o);
            TestObject(serCompressed, o);
        }

        [TestMethod]
        public void Array()
        {
            var o = new object[]
            {
                new SimpleTypeArrays(true),
                new SimpleTypeArrays(),
                new SimpleTypeArrays(true),
            };
            TestObject(ser, o);
            TestObject(serCompressed, o);
        }

        [TestMethod]
        public void ArraySparsed()
        {
            var o = new object[]
            {
                new SimpleTypeArrays(true),
                null,
                new SimpleTypeArrays(),
                null
            };
            TestObject(ser, o);
            TestObject(serCompressed, o);
        }

        [TestMethod]
        public void NullableSingleObject()
        {
            var o = new SimpleTypesNullableArrays(true);
            TestObject(ser, o);
            TestObject(serCompressed, o);
        }

        [TestMethod]
        public void NullableArray()
        {
            var o = new object[]
            {
                new SimpleTypesNullableArrays(true),
                new SimpleTypesNullableArrays(),
                new SimpleTypesNullableArrays(true),
            };
            TestObject(ser, o);
            TestObject(serCompressed, o);
        }

        [TestMethod]
        public void NullableArraySparsed()
        {
            var o = new object[]
            {
                new SimpleTypesNullableArrays(true),
                null,
                new SimpleTypesNullableArrays(),
                null
            };
            TestObject(ser, o);
            TestObject(serCompressed, o);
        }
    }
}